﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Fully Exposed Object</title>
    <script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../js/Interface.js"></script>
    <script type="text/javascript" src="../js/Helpers.js"></script>
</head>
<body>
    <div id="content">
    </div>
    <script type="text/javascript">
        var Book = function (isbn, title, author) {
            if (isbn == undefined) throw new Error('Book constructor requires an isbn.');
            this.isbn = isbn;
            this.title = title || 'No title specified';
            this.author = author || 'No author specified';
        }
        Book.prototype.display = function () {
            return String.format("{0} {1} {2}", this.isbn, this.title, this.author);
        };

        $(function () {
            // Book(isbn, title, author)
            var theHobbit = new Book('0-395-07122-4', 'The Hobbit', 'J. R. R. Tolkien');
            theHobbit.display(); // Outputs the data by creating and populating an HTML element.

            $("#content").html(theHobbit.display());
        });
    </script>
</body>
</html>
